/*
 * aboutdialog.cpp
 * ---------------
 * Begin
 *   2007-08-26
 * 
 * Last modified
 *   $Date: 2009-10-27 20:29:24 $
 *   $Revision: 1.11 $
 *
 * Copyright
 *   (C) 2007-2010 Guido Scholz <guido.scholz@bayernline.de>
 * 
 * Description
 *   Dialog window to display program information
 *
 * License
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 */

#include <qfont.h>
//#include <q3groupbox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <q3grid.h>
#include <qpixmap.h>
//Added by qt3to4:
//#include <Q3VBoxLayout>
//#include <Q3HBoxLayout>

// Qt4 Porting
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGroupBox>

#include "aboutdialog.h"

#ifdef WIN32
#include "config_w32.h"
#else
#include "config.h"
#endif

/* application icon */
#include "../icons/spdrs60_48.xpm"


AboutDialog::AboutDialog(QWidget* parent): QDialog(parent,
        "AboutDialog", true)
{
    setCaption(tr("About %1").arg(PACKAGE));
    QVBoxLayout* baseLayout = new QVBoxLayout(this, 10, 10);

    QLabel* label;

    // first line: pixmap, program name, version
    QHBoxLayout* pixmapLayout = new QHBoxLayout(baseLayout, 20, "xpmLayout");
    label = new QLabel(this, "pixmapLabel");
    pixmapLayout->addWidget(label);
    label->setPixmap(QPixmap(spdrs60_48_xpm));

    label = new QLabel(PACKAGE_STRING, this, "appLabel");
    pixmapLayout->addWidget(label);
    QFont font;
    font.setPointSize(18);
    font.setWeight(QFont::Bold);
    label->setFont(font);

    pixmapLayout->addStretch();

    // second line: description
    label = new QLabel(tr(
                "spdrs60 is a SRCP client to control digital model railways.\n"
                "Visual appearance and usage comply to the original SpDrS60\n"
                "switchbox (Spurplandrucktastenstellwerk Bauart Siemens 60)\n"
                "of the german national railroad company. spdrs60 needs a\n"
                "SRCP server (e.g. erddcd or srcpd) as hardware link."),
          this, "descLabel");
    baseLayout->addWidget(label);

    // third line: web link
    label = new QLabel("http://spdrs60.sourceforge.net/", this,
            "webLabel");
    baseLayout->addWidget(label);


    // authors groupbox
    QGroupBox* authorGB = new QGroupBox(tr("Authors"), this);
    baseLayout->addWidget(authorGB);

    QVBoxLayout* authorVBL = new QVBoxLayout;
    authorGB->setLayout(authorVBL);

    authorVBL->addWidget(new QLabel("(C) 1999-2003 Stefan Preis <stefan.preis@wdr.de>"));
    authorVBL->addWidget(new QLabel("(C) 2004-2010 Guido Scholz "
            "<guido.scholz@bayernline.de>"));

    // contributors groupbox, names in two vertical columns
    QGroupBox* contribGB = new QGroupBox(tr("Contributors"), this);
    baseLayout->addWidget(contribGB);

    QVBoxLayout* contribVBL = new QVBoxLayout;
    contribGB->setLayout(contribVBL);

    contribVBL->addWidget(new QLabel("Dirk Armbrust"));
    contribVBL->addWidget(new QLabel("Klaus Mannweiler"));
    contribVBL->addWidget(new QLabel("Sven Roth"));
    contribVBL->addWidget(new QLabel(QString::fromUtf8("David Rütti")));
    contribVBL->addWidget(new QLabel(QString::fromUtf8("André Schenk")));
    contribVBL->addWidget(new QLabel("Ullrich Schicke"));
    contribVBL->addWidget(new QLabel(QString::fromUtf8("Björn Schließmann")));
    contribVBL->addWidget(new QLabel(QString::fromUtf8("Rüdiger Seidel")));
    contribVBL->addWidget(new QLabel("Dietmar Toelg"));

    // OK button
    QHBoxLayout* buttonLayout = new QHBoxLayout(0, 0, 6);
    baseLayout->addLayout(buttonLayout);
    buttonLayout->addStretch();

    QPushButton* okPB = new QPushButton(tr("OK"), this);
    buttonLayout->addWidget(okPB);
    okPB->setDefault(true);
    connect(okPB, SIGNAL(clicked()), this, SLOT(accept()));

    buttonLayout->addStretch();
}

